{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用 tf.contrib.learn 模块加载 MNIST 数据集（Deprecated）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From <ipython-input-38-61750033177f>:6: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Please use alternatives such as official/mnist/dataset.py from tensorflow/models.\n",
      "WARNING:tensorflow:From /Users/Patient/tf-course/py3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:260: maybe_download (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Please write your own downloading logic.\n",
      "WARNING:tensorflow:From /Users/Patient/tf-course/py3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:262: extract_images (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Please use tf.data to implement this functionality.\n",
      "Extracting ./mnist/dataset/train-images-idx3-ubyte.gz\n",
      "WARNING:tensorflow:From /Users/Patient/tf-course/py3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:267: extract_labels (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Please use tf.data to implement this functionality.\n",
      "Extracting ./mnist/dataset/train-labels-idx1-ubyte.gz\n",
      "Extracting ./mnist/dataset/t10k-images-idx3-ubyte.gz\n",
      "Extracting ./mnist/dataset/t10k-labels-idx1-ubyte.gz\n",
      "WARNING:tensorflow:From /Users/Patient/tf-course/py3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/datasets/mnist.py:290: DataSet.__init__ (from tensorflow.contrib.learn.python.learn.datasets.mnist) is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "Please use alternatives such as official/mnist/dataset.py from tensorflow/models.\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "\n",
    "from tensorflow.examples.tutorials.mnist import input_data\n",
    "\n",
    "# 导入数据\n",
    "mnist = input_data.read_data_sets('./mnist/dataset/')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用 Keras 加载 MNIST 数据集\n",
    "\n",
    "\n",
    "**tf.kera.datasets.mnist.load_data(path=‘mnist.npz’)**\n",
    "\n",
    "\n",
    "**Arguments:**\n",
    "\n",
    "- **path:** 本地缓存 MNIST 数据集(mnist.npz)的相对路径（~/.keras/datasets）\n",
    "\n",
    "**Returns：**\n",
    "\n",
    "```\n",
    "Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`.\n",
    "```\n",
    "\n",
    "#### 详情查看 [mnist.load_data](https://www.tensorflow.org/api_docs/python/tf/keras/datasets/mnist/load_data) API 文档"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "from keras.datasets import mnist\n",
    "\n",
    "(x_train, y_train), (x_test, y_test) = mnist.load_data('mnist/mnist.npz')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(60000, 28, 28) (60000,)\n",
      "(10000, 28, 28) (10000,)\n"
     ]
    }
   ],
   "source": [
    "print(x_train.shape, y_train.shape)\n",
    "print(x_test.shape, y_test.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAD9CAYAAADphuMwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yL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nllwB06NABgIYNG+azuHn1+eefA0lcevTokfPf+fbb8Q7ue+65Z85/V7GbMGECAGeddRYADRokz95+j0vdowxKRESClPMMatasWQB069Yt9XSaCX8i8qxpzTXX5NhjjwVg/fXXB6BZs2aA2vDdL7/8AsSZE0Dfvn1To/fK69atGwBXXHEFAL169eI3v/kNkGS2Hu9i5E/gn376KZD7DCqKolTW9tlnn+X0d9UHHsMff/yxwCWpe2bMmAHAuHHjeP755wH417/+VeaYBx54ACA1svef//wnRx99NJC0auWCMigREQlSzjOo9dZbD4ANNtigWhnU3nvvXea8J554Akj6RrwPRVbvnHPOAZJRjqvy6quvAsloyYMPPjgV+/feey9HJQzH6NGjgeT+y7UlS5Zw1VVXAfGcM1Dmnwkf1XvppZeW+fl2222X6uNee+21812sOuGNN94A4NBDDwXgu+++I4oiAP7whz8AyXzJQYMGlTk3iqLUKN9bb701Z2XMeQXlQ7/HjRvHY489BsBOO+0EQP/+/csc26tXL5566ikAmjRpAsCcOXOAZEKprJ7fVPfffz9A6qaDuOKBJPZ+43nqvuWWWwJw3nnnpf690s8vVj6AJ19OOumk1Ncec6m+//znPwDsu+++AMyfP7/M66NGjUoN/JGYD7v3Jr399tsPiB+WAA466CBGjhwJkGre9/8XQ4YMAeDhhx9OXW/nnXfOeZnVxCciIkHK2zDzHXbYgW222QZIsqNzzz0XgKuvvhqAESNGpF5zG264IUCqOUSqtrpJuAMHDkxNZPSmEf/+8MMPB2CttdYCYKONNkoNTLnvvvsAOP/88wGKagmkb7/9Fkhily/pT/x77bVXXn93Mfjb3/4GUGHQjzdN/f73v897mUL3yiuvANCnT58yPz/ssMMAuPvuu1NdKe71118HymZOEA+M8NaYXFIGJSIiQcrrUkfla+d11123zPejR49OTbbV5LqamTdvHn/5y1+AZLLpBhtsAMCmm24KxEs/eYbqw8r986osW7YMgGuuuQZIBhQUA+9I9/eYaz4I5cMPP0z9zAcEyeqVvxc9y/cYjhgxojAFC9zo0aNTC0H739ZLLrkEiPuboeLfZ4Azzjij0us98sgjqdaWXFIGJSIiQSroYrFeO0+ZMgWAJ598ko8//hiArl27FqxcdcmKFSsAGDZsWGrUno9eeuGFFwDYbLPNgGTibqa++uqrWp0foo8++qjM99XJKGvjz3/+MxD3fZXvk5VVW7hwIQceeGClr/kw886dO+exROG74447gHgbHc+QvL/5ggsuAKBx48ap4/3viS9H55PJfSSvt55sv/32uS46oAxKREQCVdAMyp8cfSmdCRMmpJ6QDjroIAB22WUXIJm/o76psr7++msgmfME8NZbbwEVtxfwOWlStZ49e2blOr51zNSpU4HkHn/kkUdSx/jTaNOmTbPyO4vdpEmTmDx5cpmfDRgwACC17I7EfMkn75Mzs1TmdPfdd1d6zvz581Mj+nzEnzvxxBMBOP7443NS3qoEsR9Uq1atgLhJqm/fvkCyL5F/9qD6BFNfd6++O+WUU4A4BfdKPFv73vjEPu+Irg8Tdn1ofmV8SLrHxVff8KbPn3/+mZtvvhlIJjj6Kga+QoVXRr/88osm6FaTrws3ePDg1M/69esHJNMkVMmX5fffd999l/qZ75rtA3V8Ir4/NL355pssXrwYSBIB/3zccccB+W+OVhOfiIgEKYgMyvXo0SM1SMKHRD766KNAstTGF198AcTrzK2zzjoFKGUYfH281157DYifdLy5I1s8c/KnqHx1jOaTD5X193jAAQcAsMUWW1Q49s033wSSTLJRo/i/j2fzPXv2ZNiwYUCyN5kPuvBMyic5L126VGvvrYZnszvuuGOF13zgj9bZq5zv3eYLHcyZMyfVUlVVN0n79u1p2bIlkEyA9qkq2223XU7LWxVlUCIiEqSgMiiAtm3bAvHispAsqtm7d28g2a9o+vTpZTqc6xvvBPXO+I022ii1+GNt+DDT9Mm4hxxyCAAXXnhhra8fmssvvxyATp06ATBx4sQqj/UFNI844gggeYr3idCr8txzzwHJ4scaDr161113HVB2d1znk0ulct4n50sV7bjjjqnVx7t06QLAkUceCcBRRx0FxNmo/8wzqKFDh+av0JVQBiUiIkEKLoNy/gTg+z95m6o/4f/9739n+vTpQOX9BfVN06ZNazWy0eN6++23A/FCvr5T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ZNUGs6BsOfaDyGUjvnn38+APfff39Wr3vDDTcAcNJJJwHQqVOnrF6/mMyaNQuARYsWAcqgCsnHBfz8888A9OvXD4Cdd945a79DGZSIiAQprxnUjz/+CCRt7bfffjuQPA2l89Flr776KpCMlNpggw0A+O6771LnKYOqnMf7vffeK3BJioM/IZbPoDbaaCMAhg0bluqPKj+Kb9KkSQA8+eSTuS5mUfOWFcmezz//HIjnSd59990ArLnmmqs8Z9KkSUyePBmALl26AElLQDbltYJ64403ABg1alSVx/ibfe211wBo3rw5AD/88EOOS1d8fIj+tGnTKrz21ltvAdC+fXtAE3ar4+CDDwZg/vz5ZX7uldGqmptOPPFEALbccksgGeYPMGTIEAA6dOiQvcIWKR984gMnpPZ8gu2HH36YmtS/2WabrfKcs846i++//x6Ap59+Gkge1LJJTXwiIhKkvGZQVQ1z3nzzzQHYY489UkMWPXNyM2cGt39Y8NZZZx0gmTjng0rSv/bBJ3/4wx/yXLq6xzOl8vdmdbz77rtAMrk3nWexmnhefe+//z4AHTt2LHBJ6j6/n80sNeChKr5Qwueff576/5DLbFYZlIiIBCmvj2y33XYbADvttBMAffv2BZKBD2uvvXaV53p7p9TcCSecAJTNoCQ/fCiuT6VYtmxZhWPOOeecvJaprvEn9XXXXZcFCxYA8MknnxSySEXh5ptvBuDNN98EYNttt6WkpKTSYz2zuuqqq4B4onSfPn2A7A4rL08ZlIiIBCmvGZT3iZx88sk1PteXPpLM/frrr9VaxFQy56NPzz77bAA+/vhjgErb9nfddVegegvL1mdNmzYF4mH+vsyUZG7x4sVAMpq6cePGADzwwAOp5dHKu+yyywC44447gLjfNB8L9up/hoiIBCmoYUOPPfZYqnb3CXk+78GXOHL77befRvDUUIMGDaq1iKlUzrcvGT9+PFD5lg8+J6SqOLds2RKIF5zt1asXkDzBiuTSf//7XwB69+4NxIsdQJId+WjqdA888AAA1157bZmf+xY+uVaQCsonkH777bcAqVXJ02foVzUjf5NNNgFg7NixahqRvPnvf//L7rvvDsT7EmXKV6PYd999s1Gsequy4fpSkf8dfeWVV9h7773L/Mz/fvpqPRtuuCGDBw8GklVofGqQJww+ZWX//ffPQ+nVxCciIoHKWwa1cuXK1ErE/iT6zTffAMm+RZtssgn77LMPAA899BCQ7PvifE2+Z599liOOOALQTqSSH/4Uuar14KrK/J138p9++ul069YtyyWsP+655x4gN+u/FRNfA7JPnz6pZme/N7faaisgGYD28ssv88gjjwDJ+nz+N3rDDTcE4JprrslTyWPKoEREJEg5z6BWrlwJxEuT9OzZs8xrPnF3zz33BOJ9cHw/qH//+99AxR11fVfTY445JjVIwq+rpWJWrbJh5v/85z8BLXW0Om3btuVf//oXAI8++ihAqk3f992qzJgxYwAYPnx4jktY/Pr27ath5tXkC3P7gIgmTZrQqlUrAF566SUgmfZzxhlnAPFK+55NlR+k5gMqfG+5qVOnpq6XS8qgREQkSDlLOTxz8iVezj333NRr3nd01FFHAclEvGXLlqVGh/h2EGussQaQtH36IpFjx47ld7/7HQCHHnookIwGLL/twcYbb5y191WXVTbM/K9//SsAl156KZAsOyUV+ZYkxx13XLXP8Qm7yqBqL31naJ/47HvCabuYsrxvzrfNGD16NHvttVelx95yyy0ALF++nOeff77SYzyjOuiggwDykj2BMigREQlU1jMoH8V04403AnDeeecBcXunj6n3RQY9c/KtNI4//vjUUjG+o+7DDz8MQOfOnYFkafdTTz01tfujj+jxCZTO+6g+++yzrL2/uuyiiy5KbWdSnmdSF110UT6LVPR8mw2pvfTRuv5E73MqpazDDjsMSP7WrmqLGF8cwReNhWT0X6dOncoc6xPN80UZlIiIBCnrGdQzzzwDJJmT9wc9/fTTdO/eHYDp06cDycKDvoLE8uXLU+2h3k9Vvub3PqltttkmlaX1798fSLIApzkSZW2zzTaFLkKd4X2oH374IRDPGanJkkQ+OtK305ba23777VNzx7wv2pfcufzyywtWrhBV577z1SJ8OaOFCxfSpUsXILdbaNRE1iuo8iuV+8TaP//5z6kOzY8++qjSc2+//XaOPfZYoGYrPPuq0P5ZKte/f3+23HJLAKZNm1bmtYsvvhhI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WUUlJSY6Kkl9Tp06dF0VRhSU8CknxzS3FN7cU39yqj/GtUQVVUlLCO++8k3mpAmJmMwtdhvIU39xSfHNL8c2t+hhfNfGJiEiQVEGJiEiQimGLBBGpp+bNi7fN2mWXeFm9FStWAPDFF18UrEySPaqgRKTOueyyywC44447AJg7dy4ARx11VMHKJNmnJj4REQlSQTOo7777DoAXXngBgFGjRrHHHnsA0KNHjzLHDhw4EICGDRsiIvXP0qVLGTBgAJD8zTCLd5Ho2bMnALfeemthCic5oQxKRESCVJAM6plnngHgiCOOAOB///tf6rVPPom3Yyn/JOQZVefOnfNRRKknfv453l3hlVdeAWDNNdcE4I033gBg0aJFANx8880cfPDBAGy8cdXb47Rr1w6AAw88EID27avajUCqywdCDBs2jBdffLHMa2PHjgVghx12AJJ/P1k938niT3/6EwAPPPAAX3/9NQDNmzcvWLnSKYMSEZEgFSSD2nPPPQFo1qwZUDaDqooPI3311VcB6Nq1a45KJ/XJTTfdBMB555232mMffPDBal/3zDPPBGD77bcH4Pjj4/0G+/fvD0DLli1rVM76bPHixQDcf//9FV7zpX/UslJzPiT/2WefBeI4T548GYC+ffsWrFzplEGJiEiQCpJBeTvxnXfeCcAf//hHIB6l07FjRwC+/PLLMufMnz8fgKeffhpQBpUP3v/i/TTjx48HYOTIkWWOGzhwINdee21+C5cl3odRlfXXXx+AXXfdtcpjttxySyDuP/3+++8BmDRpEgBTpkwp87l79+4AdOvWrRalrh+872mfffYBkj4TgLfffhtIMlSpucaNGwNJDL/++mtmz55dyCJVoAxKRESCVNB5UP369QPgt7/9LQCTJ0+mdevWQMUMyp100kn5KVw9NW3aNAAefvjh1EjKBQsWAMmck/ImTJiQn8LlwOuvvw6QGr1UftRdkyZNgKS/dHV++uknALbaaiug4n386KOPAsqgquOhhx4CkmWLBg0axC233ALAOuusU7ByFZtzzjkHgCeeeIKPPvqowKUpK4iljq677jogHkbqw3ur8ssvv+SjSPWGDw549913gcormxYtWgBw6qmnAklz1+9//3sAGjUK4jbKSKtW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HvJ3eV59etGiRnojSzJgxI9V237BhQwD+8Y9/AEl7/amnnkqvXr0AmD59OpDsdySZ8/uwRYsWqX8Dv6f33XdfILmPvb8q3ZNPPglU7JOtD95///0KPyu/Y4H3L/kSSABvvfUWkCwk631Y/j2Q6uPThN2a8ykUhaYMSkREghREBlUZ74PyzMmtscYaQJjtpfm0ZMkSAPbbbz8gzoh8GO3vfvc7INm5+OijjwbiDMr7+fx8ZVC5tdtuuwHxQsgA/fv3B0gNqU73ySef5K9ggfjhhx+AuMXkmGOOKfOaj9j9+OOPU8f4RHPPlKradffBBx8s068lNRPK0lzKoEREJEjBZlDXX399pT/3SaerWjiyPujcuTOQjG689957U5lTeX/7299SXx966KEAtGvXLscllHQ++bRnz55A5RlU165d81qmkJhZla0iHjszS23J4SMgfe6kx85f95YWqduUQYmISJBylkH5k83QoUMBGDJkSKo9flW8b+Sqq66q9HUfFVXf+YaDPtve55Sl86dKX/Fgs802S22zoSfMmlmyZElqDs4222wDwM4771zt830B1HfffbfCa766h6+wUp8cdNBBAJx77rmp0aaeHXnfk88zA1IbQnpfk68k4fPNtCBsdtRk+blcylkF5UM777nnHiAeTjp+/Hgg2d+lVatWAHzzzTdAPFTab87yE3NHjRoF6AZ0Q4YMAZKK5u23305N9HS+avygQYOAeL8iXzZGqscfmPbaa6/ULs/Lli2r9vk+yfT2228HqPBvBNC9e3cgmbBen/i+Wc2aNUvF2uOwqoFQ5Sfq+qr8kh2+JJcP6ikUNfGJiEiQcpZBnXHGGQB8/vnnQDzMdosttgCSJyTvMPbld9JTeX968iejM888My6wFjstY+DAganPvtK7ZI+3BHj2BMnQaB+i71kAJHtw+cCUCy+8ECh7b0PcROVZgLcy1Ec+sXnixImpibVPPPFEpceeddZZqWxz2223BcpOzJXM+CLF3bt3Z+rUqQUuTVnKoEREJEg5S0d8QU0f+jx06FAOPPBAIMmq/HNlvK+ksk5lkXzZf//9gaQPCZKnft/ptU2bNqnXvN9v0qRJq7xuixYtePPNNwFlARC3lDz66KOFLka95Eujpffve6uW+qBEREQqkfMOHV86f8WKFdx7771lXvNtBnznV4B1110XUOYkYdhpp50AOOWUU7j11lvLvLa6LCmd9516P8uAAQMoKSnJTiFFsqBHjx5MnDgRSEavFpoyKBERCVLehsQ1atSII488sszP/Pubb745X8UQqZGWLVsC8QRRX3z02WefBZKJ0D6/D6BLly5lzvfFfD1b2njjjXNaXpFMnX/++antTwYPHlzg0sSUQYmISJA0qUikGho1apTa7NE/O5+LJlKXtWzZMrUtTCiUQYmISJBUQYmISJBUQYmISJBUQYmISJDM91Wp1sFmc4GZuStOXnWIoqjN6g/LH8U3txTf3FJ8c6s+xrdGFZSIiEi+qIlPRESCpApKRESCpApKRESCpApKRESCpApKRESCpApKRESCpApKRESCpApKRESCpApKRESC9P9ue+bUioKIwgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 15 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "fig = plt.figure()\n",
    "for i in range(15):\n",
    "    plt.subplot(3,5,i+1) # 绘制前15个手写体数字，以3行5列子图形式展示\n",
    "    plt.tight_layout() # 自动适配子图尺寸\n",
    "    plt.imshow(x_train[i], cmap='Greys') # 使用灰色显示像素灰度值\n",
    "    plt.title(\"Label: {}\".format(y_train[i])) # 设置标签为子图标题\n",
    "    plt.xticks([]) # 删除x轴标记\n",
    "    plt.yticks([]) # 删除y轴标记"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   3,\n",
       "         18,  18,  18, 126, 136, 175,  26, 166, 255, 247, 127,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,  30,  36,  94, 154, 170,\n",
       "        253, 253, 253, 253, 253, 225, 172, 253, 242, 195,  64,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,  49, 238, 253, 253, 253, 253,\n",
       "        253, 253, 253, 253, 251,  93,  82,  82,  56,  39,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,  18, 219, 253, 253, 253, 253,\n",
       "        253, 198, 182, 247, 241,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,  80, 156, 107, 253, 253,\n",
       "        205,  11,   0,  43, 154,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,  14,   1, 154, 253,\n",
       "         90,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 139, 253,\n",
       "        190,   2,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  11, 190,\n",
       "        253,  70,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  35,\n",
       "        241, 225, 160, 108,   1,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "         81, 240, 253, 253, 119,  25,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,  45, 186, 253, 253, 150,  27,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,  16,  93, 252, 253, 187,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0, 249, 253, 249,  64,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,  46, 130, 183, 253, 253, 207,   2,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  39,\n",
       "        148, 229, 253, 253, 253, 250, 182,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  24, 114, 221,\n",
       "        253, 253, 253, 253, 201,  78,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,  23,  66, 213, 253, 253,\n",
       "        253, 253, 198,  81,   2,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,  18, 171, 219, 253, 253, 253, 253,\n",
       "        195,  80,   9,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,  55, 172, 226, 253, 253, 253, 253, 244, 133,\n",
       "         11,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0, 136, 253, 253, 253, 212, 135, 132,  16,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0],\n",
       "       [  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,\n",
       "          0,   0]], dtype=uint8)"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_train[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py3",
   "language": "python",
   "name": "py3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
